const _ = require('lodash')

const userList = [
  {
    name: 'Tome',
    age: 18,
    gender: '男',
  },
  {
    name: 'Yome',
    age: 11,
    gender: '女',
  },
  {
    name: 'Kile',
    age: 31,
    gender: '男',
  },
  {
    name: 'Rose',
    age: 24,
    gender: '女',
  },
]

// 测试数据方法
// -1 map方法，遍历数组并返回一个新的数组
const names = _.map(userList, 'name')
const ages = _.map(userList, 'age')
console.log('筛选出name', names)
console.log('筛选出age', ages)

// -2
